package cn.edu.sasu.utils;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import cn.edu.sasu.domain.News;
import cn.edu.sasu.http.HttpNewsService;
import cn.edu.sasu.http.HttpUrl;

public class ActivityUtil {

	public static final int COUNT = 20;

	public List<News> nextPage(List<News> listOldNews, int startIndex,
			int endIndex, String title) {
		HttpNewsService service = new HttpNewsService();

		Map<String, String> parmes = new HashMap<String, String>();
		if (title != null) {
			parmes.put("news.newsTitle", title);
		}
		parmes.put("news.startIndex", startIndex + "");
		parmes.put("news.endIndex", endIndex + "");
		String data = service.requestByPost(HttpUrl.url(HttpUrl.NEWS_SELECT),
				parmes);
		List<News> list = service.parseNews(data);
		if (list.size() > 0) {
			for (News news : list) {
				listOldNews.add(news);
			}
		}
		return listOldNews;
	}
}
